#ifndef _BOARD_H
#define	_BOARD_H

#include "PChess.h"
#include <string>
#include <vector>

using namespace std;

class Board
{
public:
    Board();
    Board(string boardLayout);
    Board& operator=(const Board& other);

    int pieces[8][8];
    int status;			// like an "error code", non-zero if normal, otherwise represents check on either king, see PChess.h

    void printBoard();
    int evaluate();
    void generateMoves(vector<Board *> &possibleMoves, int ply);
    bool isLegalPosition();
    bool isInCheck(int playerColor);
    bool isInCheck(int kingRow, int kingCol, bool playerIsWhite);
    bool canCastle(bool playerIsWhite, bool kingside);
    void castle(bool playerIsWhite, bool kingside);
    void addMove(int piece, int oldRow, int oldCol, int newRow, int newCol, vector<Board *> &possibleMoves);
    void addCastleMove(bool playerIsWhite, bool kingside, vector<Board *> &possibleMoves);
    void removeCastleAbility(bool playerIsWhite);
    void printMove(int piece, int row, int col);
    void printCastleMove(bool playerIsWhite, bool kingside);
    bool operator==(const Board&);

private:
    
    void    initialValues();
    void    newGame();
    void 	newGame(string boardLayout);
    void    printPiece(int);
    
    // evaluation function components
    int evaluateMaterial();
    int evaluateCastling();
    int evaluateDevelopment();
    int evaluateMobility();
    int evaluatePawns();
    int evaluateQueenMovement();


    bool blackCanCastleQueenside;
    bool blackCanCastleKingside;
    bool whiteCanCastleQueenside;
    bool whiteCanCastleKingside;

    bool whiteHasCastled;
    bool blackHasCastled;

    int ply;
};

#endif	/* _BOARD_H */

